Skip to content

Support MCP sampling #1884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 19, 2025
Merged

Support MCP sampling #1884

merged 15 commits into from
Jun 19, 2025

Conversation

samuelcolvin
Copy link
Member

Both client and server.

To visualize, needs pydantic/logfire#1103.

Copy link

github-actions bot commented Jun 2, 2025

Docs Preview

commit: 4b315a3
Preview URL: https://cc1c0e78-pydantic-ai-previews.pydantic.workers.dev

if isinstance(content, mcp_types.TextContent):
user_part_content: str | Sequence[messages.UserContent] = content.text
else:
# image content
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use pydantic_ai.mcp._map_tool_result_part here, to cover all types of content?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some type incompatibilities, let's do this later

@samuelcolvin samuelcolvin marked this pull request as ready for review June 18, 2025 19:14
@DouweM DouweM mentioned this pull request Jun 19, 2025
17 tasks
@Kludex Kludex changed the title MCP sampling Support MCP sampling Jun 19, 2025
@Kludex Kludex enabled auto-merge (squash) June 19, 2025 06:15
@Kludex Kludex merged commit be5cda6 into main Jun 19, 2025
16 checks passed
@Kludex Kludex deleted the mcp-sampling branch June 19, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants